home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
By the Book
/
Mac C Primer V2
/
3.1 - AFI
/
AFI.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-04
|
1KB
|
59 lines
/************************************************************/
/* */
/* AFI Code from Chapter Three of */
/* */
/* *** The Macintosh Programming Primer *** */
/* */
/* Copyright 1990, Dave Mark */
/* */
/* This program demonstrates specific Mac programming */
/* techniques. */
/* */
/************************************************************/
#define BASE_ICON_ID 128
#define LAST_ICON_ID -4064
#define PROC_ID 128
#define WORD_RES_ID -4048
#define NUM_ICONS 8
#define NORMAL_APP_FONT applFont
#define DELAY 30L
main()
{
Handle procH, wHandle;
int i, fontNumber;
long dummy;
if ( ( wHandle = GetResource( 'word', WORD_RES_ID ) ) != 0L )
{
fontNumber = *( (short *)(*wHandle) );
*( (short *) 0x0204 ) = fontNumber - 1;
WriteParam();
if ( ( procH = GetResource( 'PROC', PROC_ID ) ) != 0L )
{
HLock(procH);
if ( fontNumber == NORMAL_APP_FONT )
{
CallPascal( BASE_ICON_ID + NUM_ICONS, -1, *procH);
}
else
{
CallPascal( BASE_ICON_ID, 0, *procH);
Delay( DELAY, &dummy );
for ( i=1; i<NUM_ICONS-1; i++ )
CallPascal( BASE_ICON_ID + i, 0, *procH);
CallPascal( LAST_ICON_ID, -1, *procH);
}
HUnlock(procH);
}
}
}